package extractionStockageDonnees;

import java.util.ArrayList;
import java.util.LinkedList;

/**
 * 
 * @author simon
 * 
 */
public class Course implements ICourse {
	// A Runner's List
	private ArrayList<Runner> runners;
	private LinkedList<IStep> steps;

	/**
	 * Constructor
	 * 
	 * @param runners
	 * @param points
	 * @param myParserRunner
	 * @param myParserCourse
	 */
	public Course(ArrayList<Runner> runners, LinkedList<IStep> steps) {
		this.runners = runners;
		this.steps = steps;
	}

	/**
	 * Method to find a runner by his number
	 * 
	 * @param number
	 * @return
	 */
	public Runner getRunnerByNumber(int number) {
		for (int i = 0; i <= runners.size(); i++) {
			if (runners.get(i).getNumber() == number) {
				return runners.get(i);
			} else {
				System.out.println("Runner doesn't exist.");
			}
		}
		return null;
	}

	public String getName(int number) {
		Runner myRunner = getRunnerByNumber(number);
		return myRunner.getName();
	}

	public String getSurname(int number) {
		Runner myRunner = getRunnerByNumber(number);
		return myRunner.getSurname();
	}

	public int getMoutain(int number) {
		Runner myRunner = getRunnerByNumber(number);
		return myRunner.getMountain();
	}

	public int getPlain(int number) {
		Runner myRunner = getRunnerByNumber(number);
		return myRunner.getPlain();
	}

	public int getTime(int number) {
		Runner myRunner = getRunnerByNumber(number);
		return myRunner.getTime();
	}

	public int[] getRunnersNumber() {
		int[] myRunnersNumbers = new int[runners.size()];
		for (int i = 0; i < myRunnersNumbers.length; i++) {
			myRunnersNumbers[i] = runners.get(i).getNumber();
		}
		return myRunnersNumbers;
	}

	public IStep getCurrentStep() {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean hasNextStep() {
		// TODO Auto-generated method stub
		return false;
	}

	public void init(String XML) {
		// TODO Auto-generated method stub

	}

	public void nextStep() {
		// TODO Auto-generated method stub

	}

	public void resetStep() {
		// TODO Auto-generated method stub

	}

}
